<template>
<!-- m-footer displayflex -->
  <ul class="m-footer displayflex">
    <router-link to="/index" tag="li" class="flex1" v-show="indexshow" v-bind:class="{active:status=='1'}">
      <i class="iconfont icon-index"></i>
      <p>首页</p>
    </router-link>
    <router-link to="/order" tag="li" class="flex1" v-show="ordershow" v-bind:class="{active:status=='2'}">
      <i class="iconfont icon-order"></i>
      <p>订单</p>
    </router-link>
    <router-link to="/user" tag="li" class="flex1" 
                 v-if="hasMsg"
                 v-bind:class="{active:status=='5'}">
      <i class="iconfont icon-my"></i>
      <p>我的</p>
    </router-link>
    <!-- 未登录时候 -->
    <template v-if="!hasMsg">
      <li class="flex1 active">
        <i class="iconfont icon-index"></i>
        <p>首页</p>
      </li>
      <li class="flex1" @click="goLogin">
        <i class="iconfont icon-order"></i>
        <p>订单</p>
      </li>
      <li class="flex1" @click="goLogin">
        <i class="iconfont icon-my"></i>
        <p>我的</p>
      </li>
    </template>
  </ul>
</template>

<script>
export default {
  name: "bottomBar",
  props: ["status"],
  data() {
    return {
      contactsshow: false,
      indexshow:false,
      ManShow:false,
      ordershow:false,
      orderlistshow:false,
      hasMsg:true,  
    };
  },
  created() {
    if(localStorage.userinfo){
      this.show();
      this.hasMsg = true;
    }else{
      this.hasMsg = false;
    }
  },
  methods: {
    goLogin(){
      this.$router.push({
        path:'/login'
      });
    },
    show() {
      var userinfo = JSON.parse(localStorage.userinfo);
       this.indexshow = true;
        this.ordershow = true;
      // if (userinfo.UserType == "2") {
      //   this.contactsshow = true;
      //   this.orderlistshow = true;
      //   this.ManShow = true;
      // } else {
      //   if (userinfo.UserBizType == "Salesman") {
      //     this.indexshow = true;
      //     this.ordershow=true;
      //   } else {
      //     this.ordershow = true;
      //   }
      // }
    }
  }
};
</script>
